package mspbots.data.tl.prod.datateams.listenner;

import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import mspbots.data.tl.prod.datateams.model.ResultMsg;
import mspbots.data.tl.prod.datateams.service.TeamsChannelService;
import mspbots.data.tl.prod.datateams.service.TeamsPlannersTasksService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Log4j2
@Service
@Component
@RequiredArgsConstructor
public class TeamsChannelSyncListenner {

    private final TeamsChannelService teamsChannelService;
    private final TeamsPlannersTasksService teamsPlannersTasksService;

    @RabbitListener(queues = "data-teams.group.channel.tl")
    public void syncTeamsChannel(ResultMsg resultMsg) {
        teamsChannelService.sync(resultMsg);
    }

    @RabbitListener(queues = "data-teams.planners-tasks.tl")
    public void syncTeamsPlannersTasks(ResultMsg resultMsg) {
        teamsPlannersTasksService.sync(resultMsg);
    }

}
